package org.inspursc.s0517.health.common.util;

import org.inspursc.s0517.health.common.vo.ResponseVO;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

/**
 * @author B_Dream
 * @version 创建时间：2018/5/17 14:38
 */
public class ResponseUtil {
    public static ResponseEntity<ResponseVO> success(Object object){
        ResponseVO vo= new ResponseVO(HttpStatus.OK.value(),"ok",object);
        return new ResponseEntity<>(vo,HttpStatus.OK);
    }

    public static ResponseEntity<ResponseVO> success(String message,Object o){
        ResponseVO vo= new ResponseVO(HttpStatus.OK.value(),message,o);
        return new ResponseEntity<>(vo,HttpStatus.OK);
    }


    public static ResponseEntity<ResponseVO> error400(String message, Object o){
        ResponseVO vo=new ResponseVO(HttpStatus.BAD_REQUEST.value(),message,o);
        return new ResponseEntity<>(vo,HttpStatus.BAD_REQUEST);
    }

    public static ResponseEntity<ResponseVO> error400(String message){
        ResponseVO vo=new ResponseVO(HttpStatus.BAD_REQUEST.value(),message,null);
        return new ResponseEntity<>(vo,HttpStatus.BAD_REQUEST);
    }

    public static ResponseEntity<ResponseVO> error404(String message, Object o){
        ResponseVO vo=new ResponseVO(HttpStatus.NOT_FOUND.value(),message,o);
        return new ResponseEntity<>(vo,HttpStatus.NOT_FOUND);
    }

    public static ResponseEntity<ResponseVO> error404(String message){
        ResponseVO vo=new ResponseVO(HttpStatus.NOT_FOUND.value(),message,null);
        return new ResponseEntity<>(vo,HttpStatus.NOT_FOUND);
    }

    public static ResponseEntity<ResponseVO> error(String message, Object o){
        ResponseVO vo=new ResponseVO(HttpStatus.INTERNAL_SERVER_ERROR.value(),message,o);
        return new ResponseEntity<>(vo,HttpStatus.INTERNAL_SERVER_ERROR);
    }

    public static ResponseEntity<ResponseVO> error(String message){
        ResponseVO vo=new ResponseVO(HttpStatus.INTERNAL_SERVER_ERROR.value(),message,null);
        return new ResponseEntity<>(vo,HttpStatus.INTERNAL_SERVER_ERROR);
    }







}
